package edu.sctu.practice.class02.hujie.my_practice;

import java.awt.Color;
import java.awt.Graphics;
import java.lang.Math;
import java.applet.*;

/**
 * 测试画出函数图形
 */
public class test01 extends Applet {
    int R = 150, x0 = 160, y0 = 160;

    public void paint(Graphics g) {
        int x = 0, y = 0;
        int x1 = 0, x2 = 2, y1 = 0, y2 = 0, i;
        g.setColor(Color.blue);
        for (i = 1; i < 361; i++) {
            x1 = x0 + i - 1;
            y1 = y0 + (int) (R * Math.sin(i - 1) / 180.0 * Math.PI);
            x2 = x0 + i;
            y2 = y0 + (int) (R * Math.sin(i / 180.0 * Math.PI));
            g.drawLine(x1, y1, x2, y2);
        }
    }
}
